package com.party.core.service.crowdfund.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.crowdfund.SupportTransferReadDao;
import com.party.core.dao.write.crowdfund.SupportTransferWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.audit.TransferAuditOutput;
import com.party.core.model.crowdfund.SupportTransfer;
import com.party.core.model.crowdfund.SupportTransferMaintenance;
import com.party.core.service.crowdfund.ISupportTransferService;
import com.sun.istack.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * 众筹支持转移服务接口实现
 * Created by huangwuming
 * on 2018/5/7/007.
 */
@Service
public class SupportTransferService implements ISupportTransferService {
    @Autowired
    private SupportTransferReadDao supportTransferReadDao;
    @Autowired
    private SupportTransferWriteDao supportTransferWriteDao;

    @Override
    public String insert(SupportTransfer supportTransfer) {
        BaseModel.preInsert(supportTransfer);
        boolean result = supportTransferWriteDao.insert(supportTransfer);
        if(result){
            return  supportTransfer.getId();
        }
        return null;
    }

    @Override
    public boolean update(SupportTransfer supportTransfer) {
        supportTransfer.setUpdateDate(new Date());
        return supportTransferWriteDao.update(supportTransfer);
    }

    @Override
    public boolean deleteLogic(@NotNull String id) {
        return supportTransferWriteDao.deleteLogic(id);
    }

    @Override
    public boolean delete(@NotNull String id) {
        return supportTransferWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(@NotNull Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(@NotNull Set<String> ids) {
        return false;
    }

    @Override
    public SupportTransfer get(String id) {
        return supportTransferReadDao.get(id);
    }

    @Override
    public List<SupportTransfer> listPage(SupportTransfer supportTransfer, Page page) {
        return null;
    }

    @Override
    public List<SupportTransfer> list(SupportTransfer supportTransfer) {
        return null;
    }

    @Override
    public List<SupportTransfer> batchList(@NotNull Set<String> ids, SupportTransfer supportTransfer, Page page) {
        return null;
    }

    @Override
    public SupportTransfer getBySourceId(String sourceId) {
        return supportTransferReadDao.getBySourceId(sourceId);
    }

    @Override
    public void deleteBySourceId(String sourceId) {
        supportTransferWriteDao.deleteBySourceId(sourceId);
    }

    @Override
    public void deleteByTargetId(String targetId) {
        supportTransferWriteDao.deleteByTargetId(targetId);
    }

    @Override
    public Integer getShiftToPeopleTotal(String targetId) {
        return supportTransferReadDao.getShiftToPeopleTotal(targetId);
    }
    @Override
    public List<TransferAuditOutput> getZcTransferAuditList(String themeName, String partnerId, Page page) {
        return supportTransferReadDao.getZcTransferAuditList(themeName,partnerId,page);
    }

    @Override
    public Integer getACTShiftToPeopleTotal(String eventId, int sign) {
        return supportTransferReadDao.getACTShiftToPeopleTotal(eventId,sign);
    }

    @Override
    public List<SupportTransferMaintenance> getSupporterTransfer(Integer group) {
        return supportTransferReadDao.getSupporterTransfer(group);
    }

    @Override
    public List<SupportTransfer> getByTargetProId(String projectId) {
        return supportTransferReadDao.getByTargetProId(projectId);
    }
}
